package logic

import (
	"context"
	"user_srv/internal/dao"
	"user_srv/internal/svc"
	"user_srv/user"

	"github.com/zeromicro/go-zero/core/logx"
)

type MemberDetailsLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewMemberDetailsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MemberDetailsLogic {
	return &MemberDetailsLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *MemberDetailsLogic) MemberDetails(in *user.MemberDetailsRequest) (*user.MemberDetailsResponse, error) {
	details := dao.MemberDetails(int32(in.Id))
	return &user.MemberDetailsResponse{
		Name:        details.Name,
		Mobile:      int64(details.Grade),
		Description: details.Description,
		Benefits:    details.Benefits,
	}, nil
}
